package com.itheima.comment.controller;

import com.heima.model.common.dtos.*;
import com.itheima.comment.server.CommentRepayService;
import com.itheima.comment.server.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
@Api("用户评论回复api")
public class CommentRpelyController {
    @Autowired
    private CommentRepayService commentRepayService;
    @PostMapping("/save")
    @ApiOperation("回复保存")
    public ResponseResult saveComment(@RequestBody @Validated CommentRepaySaveDTO dto){
        return commentRepayService.saveCommentRepay(dto);
    }
    @PostMapping("/load")
    @ApiOperation("回复查询")
    public ResponseResult loadComment(@RequestBody @Validated CommentRepayDTO dto){
        return commentRepayService.loadCommentRepay(dto);
    }
    @PostMapping("/like")
    @ApiOperation("回复点赞")
    public ResponseResult likeComment(@RequestBody @Validated CommentRepayLikeDTO dto){
        return commentRepayService.saveCommentRepayLike(dto);
    }
}